/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package telas;

/**
 *
 * @author BRUNO
 */
public class trocaEquipamento extends javax.swing.JInternalFrame {

    /**
     * Creates new form trocaEquipamento
     */
    public trocaEquipamento() {
        initComponents();
     // tela começa com os botoe desativados 
      tro_txt2.setEnabled(false);  
      tro_txt3.setEnabled(false);  
      tro_txt4.setEnabled(false);  
      tro_txt5.setEnabled(false);  
    
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        painel_troca1 = new javax.swing.JPanel();
        tro_lbl1 = new javax.swing.JLabel();
        tro_txt1 = new javax.swing.JTextField();
        tro_btn1 = new javax.swing.JButton();
        painel_troca2 = new javax.swing.JPanel();
        tro_lbl2 = new javax.swing.JLabel();
        tro_lbl3 = new javax.swing.JLabel();
        tro_lbl4 = new javax.swing.JLabel();
        tro_txt2 = new javax.swing.JTextField();
        tro_txt3 = new javax.swing.JTextField();
        tro_txt4 = new javax.swing.JFormattedTextField();
        painel_troca3 = new javax.swing.JPanel();
        troc_click1 = new javax.swing.JRadioButton();
        troc_click2 = new javax.swing.JRadioButton();
        tro_lbl5 = new javax.swing.JLabel();
        tro_txt5 = new javax.swing.JFormattedTextField();
        tro_btn3 = new javax.swing.JButton();
        tro_btn2 = new javax.swing.JButton();

        jLabel1.setText("jLabel1");

        setClosable(true);
        setTitle("Troca de Equipamento ");
        setPreferredSize(new java.awt.Dimension(580, 440));

        painel_troca1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        tro_lbl1.setText("Número do pedido:");

        tro_txt1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tro_txt1ActionPerformed(evt);
            }
        });

        tro_btn1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/botao_procurar.png"))); // NOI18N
        tro_btn1.setText("Pesquisar...");
        tro_btn1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tro_btn1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout painel_troca1Layout = new javax.swing.GroupLayout(painel_troca1);
        painel_troca1.setLayout(painel_troca1Layout);
        painel_troca1Layout.setHorizontalGroup(
            painel_troca1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painel_troca1Layout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addComponent(tro_lbl1)
                .addGap(54, 54, 54)
                .addComponent(tro_txt1, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(tro_btn1)
                .addContainerGap(79, Short.MAX_VALUE))
        );
        painel_troca1Layout.setVerticalGroup(
            painel_troca1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painel_troca1Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(painel_troca1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tro_lbl1)
                    .addComponent(tro_txt1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tro_btn1))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        painel_troca2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        tro_lbl2.setText("Nome do cliente:");

        tro_lbl3.setText("Nome do equipamento:");

        tro_lbl4.setText("Data da compra:");

        tro_txt2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tro_txt2ActionPerformed(evt);
            }
        });

        try {
            tro_txt4.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###-##-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        javax.swing.GroupLayout painel_troca2Layout = new javax.swing.GroupLayout(painel_troca2);
        painel_troca2.setLayout(painel_troca2Layout);
        painel_troca2Layout.setHorizontalGroup(
            painel_troca2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painel_troca2Layout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addGroup(painel_troca2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tro_lbl3)
                    .addComponent(tro_lbl2)
                    .addComponent(tro_lbl4))
                .addGap(30, 30, 30)
                .addGroup(painel_troca2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tro_txt2, javax.swing.GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE)
                    .addComponent(tro_txt4, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tro_txt3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painel_troca2Layout.setVerticalGroup(
            painel_troca2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painel_troca2Layout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addGroup(painel_troca2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tro_lbl2)
                    .addComponent(tro_txt2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painel_troca2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tro_lbl3)
                    .addComponent(tro_txt3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painel_troca2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tro_lbl4)
                    .addComponent(tro_txt4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(25, Short.MAX_VALUE))
        );

        painel_troca3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        troc_click1.setText("Autorizado para troca");
        troc_click1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                troc_click1MouseClicked(evt);
            }
        });

        troc_click2.setText("Não Autorizado para troca");
        troc_click2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                troc_click2MouseClicked(evt);
            }
        });

        tro_lbl5.setText("Data:");

        try {
            tro_txt5.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        javax.swing.GroupLayout painel_troca3Layout = new javax.swing.GroupLayout(painel_troca3);
        painel_troca3.setLayout(painel_troca3Layout);
        painel_troca3Layout.setHorizontalGroup(
            painel_troca3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painel_troca3Layout.createSequentialGroup()
                .addGap(66, 66, 66)
                .addComponent(troc_click1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(troc_click2)
                .addGap(69, 69, 69))
            .addGroup(painel_troca3Layout.createSequentialGroup()
                .addGap(199, 199, 199)
                .addComponent(tro_lbl5)
                .addGap(18, 18, 18)
                .addComponent(tro_txt5, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painel_troca3Layout.setVerticalGroup(
            painel_troca3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painel_troca3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painel_troca3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(troc_click1)
                    .addComponent(troc_click2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
                .addGroup(painel_troca3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tro_txt5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tro_lbl5))
                .addGap(19, 19, 19))
        );

        tro_btn3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/remove.png"))); // NOI18N
        tro_btn3.setText("Cancelar");
        tro_btn3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tro_btn3ActionPerformed(evt);
            }
        });

        tro_btn2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/accept.png"))); // NOI18N
        tro_btn2.setText("Salvar");
        tro_btn2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tro_btn2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(painel_troca1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(painel_troca2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(painel_troca3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(tro_btn2)
                .addGap(100, 100, 100)
                .addComponent(tro_btn3)
                .addGap(145, 145, 145))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(painel_troca1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(painel_troca2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(painel_troca3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 32, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tro_btn2)
                    .addComponent(tro_btn3))
                .addGap(23, 23, 23))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tro_txt1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tro_txt1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tro_txt1ActionPerformed

    private void tro_btn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tro_btn1ActionPerformed
    tro_txt1.setEnabled(true);    // clicando ativa todos os botoes 
    tro_txt2.setEnabled(true);    
    tro_txt3.setEnabled(true);    
    tro_txt4.setEnabled(true);    
    tro_txt5.setEnabled(true);    
        
    }//GEN-LAST:event_tro_btn1ActionPerformed

    private void tro_txt2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tro_txt2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tro_txt2ActionPerformed

    private void tro_btn2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tro_btn2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tro_btn2ActionPerformed

    private void tro_btn3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tro_btn3ActionPerformed
dispose();
    }//GEN-LAST:event_tro_btn3ActionPerformed

    private void troc_click1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_troc_click1MouseClicked
troc_click2.setEnabled(false);        //Ao clicar em autorizado este botão desabilita.
troc_click1.setEnabled(true);        
    }//GEN-LAST:event_troc_click1MouseClicked

    private void troc_click2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_troc_click2MouseClicked
       troc_click1.setEnabled(false);        //Ao clicar em autorizado este botão desabilita.
       troc_click2.setEnabled(true);        
    }//GEN-LAST:event_troc_click2MouseClicked


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel painel_troca1;
    private javax.swing.JPanel painel_troca2;
    private javax.swing.JPanel painel_troca3;
    private javax.swing.JButton tro_btn1;
    private javax.swing.JButton tro_btn2;
    private javax.swing.JButton tro_btn3;
    private javax.swing.JLabel tro_lbl1;
    private javax.swing.JLabel tro_lbl2;
    private javax.swing.JLabel tro_lbl3;
    private javax.swing.JLabel tro_lbl4;
    private javax.swing.JLabel tro_lbl5;
    private javax.swing.JTextField tro_txt1;
    private javax.swing.JTextField tro_txt2;
    private javax.swing.JTextField tro_txt3;
    private javax.swing.JFormattedTextField tro_txt4;
    private javax.swing.JFormattedTextField tro_txt5;
    private javax.swing.JRadioButton troc_click1;
    private javax.swing.JRadioButton troc_click2;
    // End of variables declaration//GEN-END:variables
}
